Filter hook 'auto_update_{$type}'

in WP Core File wp-admin/includes/class-wp-automatic-updater.php at line 268

View Source

auto_update_{$type}

Filter Hook
Description
Filters whether to automatically update core, a plugin, a theme, or a language. The dynamic portion of the hook name, `$type`, refers to the type of update being checked. Possible hook names include: - `auto_update_core` - `auto_update_plugin` - `auto_update_theme` - `auto_update_translation` Since WordPress 3.7, minor and development versions of core, and translations have been auto-updated by default. New installs on WordPress 5.6 or higher will also auto-update major versions by default. Starting in 5.6, older sites can opt-in to major version auto-updates, and auto-updates for plugins and themes. See the {@see 'allow_dev_auto_core_updates'}, {@see 'allow_minor_auto_core_updates'}, and {@see 'allow_major_auto_core_updates'} filters for a more straightforward way to adjust core updates.

Hook Information

File Location wp-admin/includes/class-wp-automatic-updater.php View on GitHub
Hook Type Filter
Line Number 268

Hook Parameters

Type Name Description
bool|null $update Whether to update. The value of null is internally used to detect whether nothing has hooked into this filter.
object $item The update offer.

Usage Examples

Basic Usage
<?php
// Hook into auto_update_{$type}
add_filter('auto_update_{$type}', 'my_custom_filter', 10, 2);

function my_custom_filter($update, $item) {
    // Your custom filtering logic here
    return $update;
}

Source Code Context

wp-admin/includes/class-wp-automatic-updater.php:268 - How this hook is used in WordPress core
<?php
 263  		 *
 264  		 * @param bool|null $update Whether to update. The value of null is internally used
 265  		 *                          to detect whether nothing has hooked into this filter.
 266  		 * @param object    $item   The update offer.
 267  		 */
 268  		$update = apply_filters( "auto_update_{$type}", $update, $item );
 269  
 270  		if ( ! $update ) {
 271  			if ( 'core' === $type ) {
 272  				$this->send_core_update_notification_email( $item );
 273  			}

PHP Documentation

<?php
/**
		 * Filters whether to automatically update core, a plugin, a theme, or a language.
		 *
		 * The dynamic portion of the hook name, `$type`, refers to the type of update
		 * being checked.
		 *
		 * Possible hook names include:
		 *
		 *  - `auto_update_core`
		 *  - `auto_update_plugin`
		 *  - `auto_update_theme`
		 *  - `auto_update_translation`
		 *
		 * Since WordPress 3.7, minor and development versions of core, and translations have
		 * been auto-updated by default. New installs on WordPress 5.6 or higher will also
		 * auto-update major versions by default. Starting in 5.6, older sites can opt-in to
		 * major version auto-updates, and auto-updates for plugins and themes.
		 *
		 * See the {@see 'allow_dev_auto_core_updates'}, {@see 'allow_minor_auto_core_updates'},
		 * and {@see 'allow_major_auto_core_updates'} filters for a more straightforward way to
		 * adjust core updates.
		 *
		 * @since 3.7.0
		 * @since 5.5.0 The `$update` parameter accepts the value of null.
		 *
		 * @param bool|null $update Whether to update. The value of null is internally used
		 *                          to detect whether nothing has hooked into this filter.
		 * @param object    $item   The update offer.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/class-wp-automatic-updater.php
Related Hooks

Related hooks will be displayed here in future updates.